namespace Web.Page.Intl
{
    using System;
    using System.Data;
    using System.Configuration;
    using System.Collections;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;
    using Lx.Web.Common.UI;
    using Lx.Web.Common.ControlsUI;

    public partial class Intl_Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string ReUrl = System.Configuration.ConfigurationManager.AppSettings["WWWHost"];
            string lng = null;
            if (Request["ReturnUrl"] != null)
            {
                ReUrl = Request["ReturnUrl"].ToString();
            }
            if (Request["lng"] != null)
            {
                lng = Request["lng"].ToString().ToLower();
                if (Page.User.Identity.Name != "")
                {
                    BLF.WWW_User.Users.User.UpdateBaseLanguage(Page.User.Identity.Name, lng);
                }
            }
            else
            {
                lng = HttpContext.Current.Request.UserLanguages.GetValue(0).ToString().ToLower();
            }
            HttpCookie authCookie = new HttpCookie("Language", lng);
            authCookie.Domain = System.Configuration.ConfigurationManager.AppSettings["Domain"];
            authCookie.Expires = DateTime.Now.AddYears(50);
            HttpContext.Current.Response.Cookies.Add(authCookie);
            Page.Response.Redirect(ReUrl);
        }
    }
}
